<?php
#注册插件
RegisterPlugin("Jz52_subinde","ActivePlugin_Jz52_subinde");

function ActivePlugin_Jz52_subinde() {
    Add_Filter_Plugin('Filter_Plugin_ViewPost_Template', 'Jz52_subinde_main');
}

function Jz52_subinde_main(&$template){      	
    global $zbp;
	$article = $template->GetTags('article');   
	$html='<link rel="stylesheet" href="'.$zbp->host.'zb_users/plugin/Jz52_subinde/style/style.css"><style>.jztagtree{max-height:'.$zbp->Config('Jz52_subinde')->height.'vh;'.$zbp->Config('Jz52_subinde')->lorr.':'.$zbp->Config('Jz52_subinde')->width.'px}.jzDown{top:'.$zbp->Config('Jz52_subinde')->top.'vh}.jztagtree li a{background-color:#'.$zbp->Config('Jz52_subinde')->color.'}.jztagtree li a:before{border-right:10px solid #'.$zbp->Config('Jz52_subinde')->color.'}.jztagtree li a:hover{background:#'.$zbp->Config('Jz52_subinde')->colorh.'}.jztagtree li a:hover::before{border-right:10px solid #'.$zbp->Config('Jz52_subinde')->colorh.'}'.$zbp->Config('Jz52_subinde')->css.'</style><div id="jztest" class="jztagtree"><ul id="jztoc"></ul></div><script src="'.$zbp->host.'zb_users/plugin/Jz52_subinde/script/myToc.js"></script><script type="text/javascript">$("#jztoc").toc({content: "'.$zbp->Config('Jz52_subinde')->bodyc.'", headings: "'.$zbp->Config('Jz52_subinde')->titeb.'"});</script>';
	$article->Content.=$html;
}

function InstallPlugin_Jz52_subinde() {
	global $zbp;
	if(!$zbp->Config('Jz52_subinde')->HasKey('Version')){
		$zbp->Config('Jz52_subinde')->Version = '1.1.0';
		$zbp->Config('Jz52_subinde')->top = '10';
		$zbp->Config('Jz52_subinde')->height = '85';
		$zbp->Config('Jz52_subinde')->color = '448EF6';
		$zbp->Config('Jz52_subinde')->colorh = '0045a6';
		$zbp->Config('Jz52_subinde')->titeb = 'h2,h3,h4';
		$zbp->Config('Jz52_subinde')->bodyc = '.post-body';
		$zbp->Config('Jz52_subinde')->width = '0';
		$zbp->Config('Jz52_subinde')->lorr = 'left';
		$zbp->Config('Jz52_subinde')->css = '';
		$zbp->Config('Jz52_subinde')->DelCon = '0';
		$zbp->SaveConfig('Jz52_subinde');
	}
	$zbp->SaveConfig('Jz52_subinde');
}
function UninstallPlugin_Jz52_subinde() {
	global $zbp;
	if ($zbp->Config('Jz52_subinde')->DelCon){
		$zbp->DelConfig('Jz52_subinde');
	}		
}